@import url("hue.less");
@import url("saturation.less");
@import url("lightness.less");

@clrizr-input-saturation: 1px+floor(saturation(@clrizr-input))-1;
@clrizr-input-lightness: 1px+floor(lightness(@clrizr-input))-1;

@clrizr-complementary-hue: formatstring("clrizr-hue-source-{0}", ceil(hue(@clrizr-input)));

@clrizr-primary-2-saturation: formatstring("clrizr-saturation-s2SV{0}",@clrizr-input-saturation);
@clrizr-primary-1-saturation: formatstring("clrizr-saturation-s1SV{0}",@clrizr-input-saturation);
@clrizr-complementary-1-saturation: formatstring("clrizr-saturation-c1SV{0}",@clrizr-input-saturation);

@clrizr-primary-2-lightness: formatstring("clrizr-lightness-s2LV{0}",@clrizr-input-lightness);
@clrizr-primary-1-lightness: formatstring("clrizr-lightness-s1LV{0}",@clrizr-input-lightness);
@clrizr-complementary-1-lightness: formatstring("clrizr-lightness-c1LV{0}",@clrizr-input-lightness);

@clrizr-primary-2: hsl(hue(@clrizr-input), @@clrizr-primary-2-saturation, @@clrizr-primary-2-lightness);
@clrizr-primary-1: hsl(hue(@clrizr-input), @@clrizr-primary-1-saturation, @@clrizr-primary-1-lightness);
@clrizr-primary: @clrizr-input;
@clrizr-complementary-1: hsl(@@clrizr-complementary-hue, @@clrizr-complementary-1-saturation, @@clrizr-complementary-1-lightness);
@clrizr-complementary-2: hsl(@@clrizr-complementary-hue, saturation(@clrizr-input), lightness(@clrizr-input));

@clrizr-perceptive-luminance-ps2: round(1 - ( (0.299 *  red(@clrizr-primary-2)		)	+ ( 0.587 * green(@clrizr-primary-2)		)	+ (0.114 * blue(@clrizr-primary-2)))/255)*255;
@clrizr-perceptive-luminance-ps1: round(1 - ( (0.299 *  red(@clrizr-primary-1)		)	+ ( 0.587 * green(@clrizr-primary-1)		)	+ (0.114 * blue(@clrizr-primary-1)))/255)*255;
@clrizr-perceptive-luminance-ps:  round(1 - ( (0.299 *  red(@clrizr-primary)		)	+ ( 0.587 * green(@clrizr-primary)		)	+ (0.114 * blue(@clrizr-primary)))/255)*255;
@clrizr-perceptive-luminance-pc1: round(1 - ( (0.299 *  red(@clrizr-complementary-1))	+ ( 0.587 * green(@clrizr-complementary-1))	+ (0.114 * blue(@clrizr-complementary-1)))/255)*255;
@clrizr-perceptive-luminance-pc2: round(1 - ( (0.299 *  red(@clrizr-complementary-2))	+ ( 0.587 * green(@clrizr-complementary-2))	+ (0.114 * blue(@clrizr-complementary-2)))/255)*255;

@clrizr-col-font-on-primary-2: rgb(@clrizr-perceptive-luminance-ps2, @clrizr-perceptive-luminance-ps2, @clrizr-perceptive-luminance-ps2);
@clrizr-col-font-on-primary-1: rgb(@clrizr-perceptive-luminance-ps1, @clrizr-perceptive-luminance-ps1, @clrizr-perceptive-luminance-ps1);
@clrizr-col-font-on-primary: rgb(@clrizr-perceptive-luminance-ps, @clrizr-perceptive-luminance-ps, @clrizr-perceptive-luminance-ps);
@clrizr-col-font-on-complementary-1: rgb(@clrizr-perceptive-luminance-pc1, @clrizr-perceptive-luminance-pc1, @clrizr-perceptive-luminance-pc1);
@clrizr-col-font-on-complementary-2: rgb(@clrizr-perceptive-luminance-pc2, @clrizr-perceptive-luminance-pc2, @clrizr-perceptive-luminance-pc2);